#include <cstdio>

int main( )
{
    int t1, t2, n, k;
    char c1[ 2 ], c2[ 2 ];
    scanf("%d", &k);
    while ( k-- )
    {
        scanf("%d", &n);
        t1 = t2 = 0;
        while ( n-- )
        {
            scanf("%s%s", c1, c2);
            if ( c1[ 0 ] == 'R' )
            {
                if ( c2[ 0 ] == 'S' )
                    t1++;
                if ( c2[ 0 ] == 'P' )
                    t2++;
            }
            if ( c1[ 0 ] == 'S' )
            {
                if ( c2[ 0 ] == 'P' )
                    t1++;
                if ( c2[ 0 ] == 'R' )
                    t2++;
            }
            if ( c1[ 0 ] == 'P' )
            {
                if ( c2[ 0 ] == 'R' )
                    t1++;
                if ( c2[ 0 ] == 'S' )
                    t2++;
            }
        }
        if ( t1 > t2 )
            puts("Player 1");
        if ( t1 == t2 )
            puts("TIE");
        if ( t1 < t2 )
            puts("Player 2");
    }
    return 0;
}
